<?php

namespace StudyBuddy\Modules\Observers;

use \StudyBuddy\SearchFactory;

/**
 * Observer listens to onNewQuestion
 * and will create blocks with similar items
 * and add them to oQuestion object
 * the object will then be auto-saved to Mongo from
 * __destructor
 *
 * The ways it was supposed to work is to add
 * simtabs via a registered observer (this class)
 *
 */
class Similars extends \StudyBuddy\Observer {

    protected function main() {
        d('cp');
        if ('onNewQuestion' === $this->eventName) {
            $oQuestion = $this->obj;
            $oParser = SearchFactory::factory($this->oRegistry);
            $oParser->getSimilarQuestions($oQuestion);
        }
    }

}
